from app.api import abstract

MAX_ITEMS = 200

class Action(abstract.Action):
    def _get(self):
        
        owner_id = self.param("user_id")

        if owner_id == "" or owner_id == "viewer":
            owner_id = self.viewer_id
        elif owner_id == "owner":
            owner_id = self.owner_id
    
        mc_key = "ws/u/0/" + owner_id
        
        data = abstract.memcache.get(mc_key)
        
        if not data:

            wishes = abstract.models.wish.listByUser(owner_id)
            
            data = abstract.models.wish.format(wishes)
            
            abstract.memcache.set(mc_key, data)
            
        return data